# coding=utf-8
class Solution:
    def longestCommonPrefix(self, strs) -> str:
        if len(strs) == 1: return strs[0]
        qz = strs[0]
        res = ''
        index = []
        for i in strs:
            if len(i) == 0: return i
            for j in range(min(len(qz), len(i))):
                if i[j] != qz[j]:
                    index.append(j)
                    break
            else:
                index.append(j + 1)
        print(index)
        res += qz[:min(index)]
        return res


a = Solution()
print(a.longestCommonPrefix([""]))
